﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Prion Lite 1.3 - A Polymorphic XSS Worm by John Leitch</title>
    <style type="text/css">
        table
        {
            width: 100%;
        }
        td
        {
            vertical-align: top;
            padding: 5px 5px 5px 5px;
        }
        
        .infoPanel 
        {
            
        }        
        .infoPanel div
        {
            border: solid 1px black;
            padding: 0px 5px 5px 5px;
            overflow: auto;
            margin: 0px 0px 8px 0px;
        }
        .infoPanel h1
        {
            font-size: 110%;
            margin-top: 4px;
            margin-bottom: 0px;
        }   
        
        .infoTable 
        {
            
        }
        .infoTable td 
        {            
            border: solid 1px black;
        }        
    </style>
    <script type="text/javascript">

        var iteration = 0, minSize = 0xFFFFFFFF, maxSize = -1;
        var replicating = false;

        setInterval("if(replicating)evalWorm();", 1000);

        function setHTML(id, html) {
            document.getElementById(id).innerHTML = html;
        }

        function getCode() {
            return document.getElementById('xssWormLite13').value.replace('&lt;', '<');
        }

        function evalWorm() {
            var code = getCode();

            try {
                eval(code);
                iteration++;

                if (document.body.lastChild.src != null)
                    document.body.removeChild(document.body.lastChild);
            }
            catch (e) {
                document.getElementById('errors').innerHTML += '<br />' + e;
                toggleReplication();
            }

            setTimeout('checkWorm();', 100);
        }

        function checkWorm() {
            setHTML('iteration', iteration);

            var code = getCode();

            setHTML('curSize', code.length);

            if (code.length < minSize) {
                minSize = code.length;

                setHTML('minSize', minSize);
            }

            if (code.length > maxSize) {
                maxSize = code.length;

                setHTML('maxSize', maxSize);
            }            
        }

        function toggleReplication() {
            replicating = !replicating;
            document.getElementById('replicateButtonLite13').value =
                (replicating ? 'Stop' : 'Start') + ' Replicating';
        }        
    </script>
</head>
<body>
<table>
    <tr>
        <td style="width:80%;">
            <textarea id="xssWormLite13" style="width:100%;height:600px">var s=document.createElement("script");s["src"]="PrionLite.js";document.body.appendChild(s);</textarea>
        </td>
        <td class="infoPanel">
            <div>
                <h1>General</h1>
                <table class="infoTable">
                    <tr>
                        <td style="width:80px;">Iteration</td>
                        <td><span id="iteration"></span></td>
                    </tr>                    
                </table>
            </div>
            <div>
                <h1>Size</h1>
                <table class="infoTable">
                    <tr>
                        <td style="width:80px;">Current</td>
                        <td><span id="curSize"></span></td>
                    </tr>
                    <tr>
                        <td>Min</td>
                        <td><span id="minSize"></span></td>
                    </tr>
                    <tr>
                        <td>Max</td>
                        <td><span id="maxSize"></span></td>
                    </tr>                
                </table>
            </div>
            <div style="height:120px;">
                <h1>Errors</h1>
                <span id="errors"></span>
            </div>            
        </td>
    </tr>
</table>
    
    <input id="replicateButtonLite13" type="button" onclick="toggleReplication()" value="Start Replicating" />    
</body>
</html>
